package com.feng.leetcode;

import java.util.Comparator;
import java.util.List;
import java.util.TreeMap;
import java.util.stream.Collectors;

/**
 * @author feng
 * @decrition
 * @date 2022/11/1323:26
 */
public class L2418 {
    public static String[] sortPeople(String[] names, int[] heights) {
        TreeMap<Integer, String> map = new TreeMap<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });
        for (int i = 0; i < heights.length; i++) {
            map.put(heights[i], names[i]);
        }
        List<String> collect = map.values().stream().collect(Collectors.toList());
        return collect.toArray(new String[0]);
    }

    public static void main(String[] args) {

    }
}
